<?php
function verifyid($p,$userid,$userpsw) {
        return true;
//        if (empty($userid) || empty($userpsw)) {
//                return false;
//        } else {
//                include "$p/dbconfig/config.php";
//		include "$p/dbconfig/opendb.php";
//
//		$query  = "SELECT password FROM user WHERE username='$userid'";
//		$result = mysql_query($query) or die("System down please contact jgao@mizzou.edu, with the following information:$query. <br/>Thanks!");
//		while ($row = mysql_fetch_array($result)) {
//			$psw = md5($row["password"]);
//		}
//		if (!empty($psw) && $psw==$userpsw) {
//                        //if (strcmp($userid,"p3dbadmin")!=0) {
//                            //$query = "INSERT INTO user_visit(userid,ip,date) VALUES ('$userid','{$_SERVER['REMOTE_ADDR']}',NOW());";
//                            //if (mysql_query($query)){
//
//                            //}
//                        //}
//                        return true;
//		} else {
//			setcookie("p3dbuserid","",time() - 3600);
//                        return false;
//		}
//		include "$p/dbconfig/closedb.php";
//        }
}

function verifyandforward($p) {
        $userid = $_COOKIE['p3dbuserid'];
        $userpsw = $_COOKIE['p3dbuserpsw'];
        if (!verifyid($p,$userid,$userpsw)) {
                //header("Location: {$p}/index.php");
                ?>
                <html>
                <head>
                <meta http-equiv="REFRESH" content="0;url=<?php echo $p?>">

                </head>
                </html>
                <?php
        }
}

function getTop($p) {
    verifyandforward($p);
    getHeader($p);
    getTopBody($p);
}

function getTopWithJS($p) {
    verifyandforward($p);
    getHeaderWithJS($p);
    getTopBody($p);
}

function getTopWithInclude($p,$includes) {
        verifyandforward($p);
        getHeaderWithExtenalInclude($p,$includes);
        getTopBody($p);
}

function getHeader($p) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>P3DB: Plant Protein Phosphorylation Database</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="<?php echo $p; ?>/css/style.css" type="text/css" />
        <!--link rel="shortcut icon" href="< ?php echo $p; ?>/images/p3dblogo.jpg" /-->
</head>
<?php
}

function getHeaderWithExtenalInclude($p,$includes) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?php ?>
	<title>P3DB: Plant Protein Phosphorylation Database</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="<?php echo $p; ?>/css/style.css" type="text/css" />
        <!--link rel="shortcut icon" href="< ?php echo $p; ?>/images/p3dblogo.jpg" /-->
        <?php foreach($includes as $include){include $include;} ?>
</head>
<?php
}

function getHeaderWithJS($p) {

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?php ?>
	<title>P3DB: Plant Protein Phosphorylation Database</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="<?php echo $p; ?>/css/style.css" type="text/css" />
        <!--link rel="shortcut icon" href="< ?php echo $p; ?>/images/p3dblogo.jpg" /-->
        <script src="<?php echo $p."/css/util.js"; ?>" language="javascript" type="text/javascript"></script>

</head>
<?php
}

function getTopBody($p) {
?>
<!--body bgcolor="#F3FDE2"-->
<body bgcolor="#AAAAAA">
<table><tr><td height="5"></td></tr></table>
<table align="center" width="950" border="0" cellspacing="0" cellpadding="0" bgcolor="#FCFDEF">
        <!--tr><td colspan="4" bgcolor="#FCFDEF" height="10"></td></tr-->
	<tr bgcolor="#FCFDEF" valign="bottom">
	<td bgcolor="#FCFDEF" align="center"><img src="<?php echo $p; ?>/images/maintitle.jpg" width="145" height="77" /></td>
        <!--td bgcolor="#FCFDEF" id="logo">P<sup>3</sup>DB</td-->
        <td bgcolor="#FCFDEF">&nbsp;</td>
	<td bgcolor="#FCFDEF"><img src="<?php echo $p; ?>/images/subtitle.jpg" width="449" height="67" /></td>
        <!--td bgcolor="#FCFDEF" id="tagline"><u>P</u>lant <u>P</u>rotein <u>P</u>hosphorylation <u>D</u>ata<u>B</u>ase</td-->
        </tr>
        <!--tr><td colspan="4" bgcolor="#FCFDEF" height="10"></td></tr-->

        <tr><td colspan="4" bgcolor="#607D51">&nbsp;</td></tr>

        <tr>
        <td valign="top">

<!-- QuickMenu Structure [Menu 0] -->
<ul id="qm0" class="qmmc">

	<li><a href="<?php echo $p; ?>/" title="Home page">Home</a></li>
	<li><a href="<?php echo $p; ?>/search/" title="Search for phosphorylation proteins or peptides in P3DB">Search</a></li>
	<li><a href="<?php echo $p; ?>/blast/" title="BLAST your sequences against P3DB phosphorylation data">BLAST</a></li>
	<li><a href="<?php echo $p; ?>/browser/" title="Browse phosphorylation proteins">Browse</a></li>
	<li><a href="<?php echo $p; ?>/tools/" title="Phosphorylation data analysis tools">Tools</a></li>
	<li><a href="<?php echo $p; ?>/download/" title="Download P3DB datasets">Download</a></li>
	<li><a href="<?php echo $p; ?>/submit.php" title="Submit your phosphorylation dataset">Submit</a></li>
	<!--li><a href="<?php echo $p; ?>/help/" title="help and tutorial about this website">Help</a></li-->
    <li><a href="<?php echo $p; ?>/contact.php" title="Personnel and contact information">Contact</a></li>
    <li><a href="<?php echo $p; ?>/publication.php" title="Publications">Publications</a></li>
    <li class="qmclear">&nbsp;</li>
</ul>

				&nbsp;<br/>
				&nbsp;<br/>

				<table border="0" cellspacing="0" cellpadding="0" width="152" id="navigation" bgcolor="#607D51">
					<tr>
                                                <td>&nbsp;<br /> &nbsp;<br /></td><td> &nbsp;</td>
					</tr>
					<tr valign="middle">
						<td align="right"><img src="<?php echo $p; ?>/images/jaylogo.jpg" width="30" height="30"></td>
						<td><a href="http://www.oilseedproteomics.missouri.edu"  class="navText">Thelen Lab</a></td>
					</tr>
					<tr valign="middle">
						<td align="right"><img src="<?php echo $p; ?>/images/dbllogo.jpg" width="30" height="30"></td>
						<td><a href="http://digbio.missouri.edu"  class="navText">Xu Lab</a></td>
					</tr>
					<tr valign="middle">
						<td align="right"><img src="<?php echo $p; ?>/images/mulogo.jpg" width="30" height="30"></td>
						<td><a href="http://www.missouri.edu"  class="navText">Mizzou</a></td>
					</tr>
					<tr valign="middle">
						<td align="right"><img src="<?php echo $p; ?>/images/nsflogo.jpg" width="30" height="30"></td>
						<td><a href="http://www.nsf.gov"  class="navText">NSF</a></td>
					</tr>
					<tr>
                                                <td colspan="2" align="right"><a href="<?php echo $p; ?>/links.php">more links</a></td>
					</tr>
                                        <tr>
                                                <td>&nbsp;<br /> &nbsp;<br /></td><td> &nbsp;</td>
					</tr>
				</table>
				&nbsp;<br/>

			</td>
			<td>&nbsp;</td>
			<td valign="top">
				<!--begin content-->
<?php
}

function getBottom() {
?>

				<!--end content-->
				&nbsp;<br />
			</td>
		</tr>
		<tr>
			<td colspan="4"><hr/></td>
		</tr>
		<tr>
			<td colspan="4" align="center" class="smallText">&copy; 2008-2011 <a href="http://www.missouri.edu">University of Missouri</a>.</td>
		</tr>
		<tr>
			<td width="165">&nbsp;</td>
			<td width="35">&nbsp;</td>
			<td width="700">&nbsp;</td>
                        <td width="50">&nbsp;</td>
		</tr>
	</table>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4913029-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    
<script type="text/javascript">
$(document).ready(function(){
  $("#downloadsubmit").click(function(){
  	if ($("#subannounce").is(':checked')) {
			$.post("http://groups.google.com/group/p3db-announce/boxsubscribe",
				{email:$("#downloademail").val(),sub:"Subscribe"});
  	}
  });
});
</script>

</body>
</html>
<?php
}
?>


